package cn.chencaiju.domain;

import java.util.Date;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Document(indexName = "product")
public class Product {
	@Id
	private int id;
	
	@Field(index=true,store=true,analyzer="ik_smart",type=FieldType.Text)
	private String name;

	@Field(index = false, store = true, type = FieldType.Integer)
	private int catelog;
	
	@Field(index=true,store=true,type=FieldType.Keyword)
	private String catelogName;
	
	@Field(index=true,store = true, type = FieldType.Double)
	private double price;
	
	@Field(index = false, store = true, type = FieldType.Long)
	private int number;
	
	@Field(index=true,store=false,analyzer="ik_smart",type=FieldType.Text)
	private String description;

	@Field(index = false, store = true, type = FieldType.Keyword)
	private String picture;

	@Field(index = true, store = true, type = FieldType.Date)
	private Date	releaseTime;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getCatelog() {
		return catelog;
	}
	public void setCatelog(int catelog) {
		this.catelog = catelog;
	}
	public String getCatelogName() {
		return catelogName;
	}
	public void setCatelogName(String catelogName) {
		this.catelogName = catelogName;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public int getNumber() {
		return number;
	}
	public void setNumber(int number) {
		this.number = number;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getPicture() {
		return picture;
	}
	public void setPicture(String pictrue) {
		this.picture = pictrue;
	}
	public Date getReleaseTime() {
		return releaseTime;
	}
	public void setReleaseTime(Date releaseTime) {
		this.releaseTime = releaseTime;
	}
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Product [id=");
		builder.append(id);
		builder.append(", name=");
		builder.append(name);
		builder.append(", catelog=");
		builder.append(catelog);
		builder.append(", catelogName=");
		builder.append(catelogName);
		builder.append(", price=");
		builder.append(price);
		builder.append(", number=");
		builder.append(number);
//		builder.append(", description=");
//		builder.append(description);
		builder.append(", pictrue=");
		builder.append(picture);
		builder.append(", releaseTime=");
		builder.append(releaseTime);
		builder.append("]");
		return builder.toString();
	}
}
